import javax.media.opengl.GL2;
import javax.media.opengl.GL2ES1;
import javax.media.opengl.fixedfunc.GLLightingFunc;

/**
 * Created by IntelliJ IDEA.
 * User: blakekl10
 * Date: 2/12/11
 * Time: 9:36 AM
 * To change this template use File | Settings | File Templates.
 */
public class Light {
    private float ambient[] = { 0.0f, 0.0f, 0.0f, 1.0f };
    private float diffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f };
    private float specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };
    //1.0 for 4th parameter means light is like a light bulb, in that location.
    //0.0 for 4th parameter means light is like the sun, shining from that vertor evenly across all objects.
    private float position[] = { 0.0f, 10.0f, 10.0f, 0.0f };
    private float lmodel_ambient[] = { 0.1f, 0.1f, 0.1f, 1.0f };
    private float spotDir[] = {0.0f, 0.0f, 0.0f};

    public void render(GL2 gl){
        gl.glLightfv(GLLightingFunc.GL_LIGHT0, GLLightingFunc.GL_AMBIENT, ambient, 0);
        gl.glLightfv(GLLightingFunc.GL_LIGHT0, GLLightingFunc.GL_DIFFUSE, diffuse, 0);
        gl.glLightfv(GLLightingFunc.GL_LIGHT0, GLLightingFunc.GL_SPECULAR, specular, 0);
        gl.glLightfv(GLLightingFunc.GL_LIGHT0, GLLightingFunc.GL_POSITION, position, 0);
        gl.glLightModelfv(GL2ES1.GL_LIGHT_MODEL_AMBIENT, lmodel_ambient, 0);
        gl.glEnable(GLLightingFunc.GL_LIGHTING);
        gl.glEnable(GLLightingFunc.GL_COLOR_MATERIAL);
        gl.glEnable(GLLightingFunc.GL_LIGHT0);
    }
}
